package com.corpgovernment.common.base;

/**
 * @program: corpgovernment-common-logging
 * @description: ThreadLocl util
 * @author: wubing
 * @create: 2019-06-04 14:54
 */
public class ContextUtils<T> {
    public static ContextUtils INSTANCE = new ContextUtils();

    private ContextUtils() {
        contextHolder = new ThreadLocal<T>();
    }

    private ThreadLocal<T> contextHolder = null;

    public T get() {
        return (T) contextHolder.get();
    }

    public void set(T input) {
        contextHolder.set(input);
    }

    public void remove() {
        contextHolder.remove();
    }
}
